<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>分步表单-添加</title>
		<link rel="stylesheet" href="../../utils/layui/css/layui.css">
		<style>
			@charset "UTF-8";
			
			body {
			}
			
			.page_container {
				border: 1px solid #f2f2f2;
				border-radius: 5px;
				background-color: #ffffff;
				padding: 20px;
			}
			
			.page_container .zhongxian {
				opacity: 0.15;
			}
			
			.page_container .atitle {
				margin-left: 20px;
				padding: 0 10px;
				font-size: 20px;
				font-weight: 300;
			}
			.layui-layer-dialog .layui-layer-setwin{
				display: none;
			}
			.finder-image{
				width: 100%;
			}
			.finder-image-preview{
			float: left;
			max-width: 400px;
			background: #eee;
			overflow: hidden;
			position: relative;
			color: #000;
			cursor:pointer;
			min-width: 200px;
			margin-right: 8px;
			}
			.finder-image-preview .image-preview{
			color: #000;
			line-height: 200px;
			text-align: center;
			}
			.finder-image-button{
			width:20px;
			min-height:200px;
			float: left;
			background: #fff;
			overflow: hidden;
			padding-left: 1px;
			}
			.clone-one-image:hover{
				color: #FF0000;
			}
			.preview-text{
				padding-top: 3px;
				width: 100%; 
				overflow: hidden;
				background: #fff;
			}
			.preview-text-input{
				width: 100%;
				background: #fff;
				height: 28px;
				border: none;
			}
			.preview-text-input:hover{
				background-color: #d2d2d2;
			}
			.required{
				font-size: 16px;
				color: #f00;
				font-family: Tahoma;
				vertical-align: middle;
				margin-right: 2px;
				font-weight: 400;color: #f00;
				font-weight: 400;margin-right: 5px;
			}
			.layui-anim {
				z-index: 9999 !important;
			}
		</style>
		<link rel="stylesheet" href="../../utils/layui/css/layui.css">
		<script type="text/javascript" src="../../utils/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" src="../../utils/ueditor/ueditor.all.min.js"></script>
		<script type="text/javascript" src="../../utils/ueditor/lang/zh-cn/zh-cn.js"></script>
	</head>
	<body>
		<div id="view" type="text/html">
			<form class="layui-form" action=""  method="post"  onsubmit="return false;">
				<input id="_method" type="hidden" name="_method" value="POST">
				<input type="hidden" name="_method_" id="_method_" value="" />
				<input type="hidden" name="toolbar" id="toolbar" value="head" />
				<div class="layui-tab" lay-filter="docDemoTabBrief">
				  <ul class="layui-tab-title" id="layui-tab-ul">
					{{#  arr_foreach(d.stepform_fields, function(index, item){ }}
					  <li id="layertab{{index}}" data-index="{{index}}"   class="{{#  if(index == 0){ }}layui-this{{#  } }}">{{ item.title }}</li>
				    {{#  }); }}
				  </ul>
				  <div class="layui-tab-content">
					{{#  arr_foreach(d.stepform_fields, function(index, item){ }}
					<div class="layui-tab-item{{#  if(index == 0){ }} layui-show {{#  } }}"   id="stepFormItem{{index}}" data-index="{{index}}">
						{{#  arr_foreach(item.field, function(key, value){ }}
						
							{{#  if(value.input_type == 'hidden'){ }}
								<input data-label="{{value.label}}" type="hidden" name="{{item.db_table}}[{{value.field}}]" maxlength="" placeholder="请输入{{value.label}}" autocomplete="off" class="layui-input" maxlength="{{value.input_maxlength}}" value="{{input_default(value.default)}}" data-tabinx="{{index}}">
								
							{{#  }else if(value.input_type == 'password'){ }}
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
							        <input data-label="{{value.label}}" type="password" name="{{item.db_table}}[{{value.field}}]" placeholder="请输入{{value.label}}" autocomplete="off" class="layui-input" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" value="{{input_default(value.default)}}" data-tabinx="{{index}}">
							      </div>
							    </div>
								
							{{#  }else if(value.input_type == 'radio'){ }}
							    <!--得保证value是有序数组--->
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  {{#  arr_foreach(value.value, function(k1, v1){ }}
										  {{#  if(k1 == value.default){ }}
											<input data-label="{{value.label}}" type="radio" name="{{item.db_table}}[{{value.field}}]" value="{{k1}}" title="{{v1}}" checked="" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
										  {{# }else{ }}   
											<input data-label="{{value.label}}" type="radio" name="{{item.db_table}}[{{value.field}}]" value="{{k1}}" title="{{v1}}" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
										  {{# } }} 
									  {{#  }); }}
							      </div>
							    </div>	
							{{#  }else if(value.input_type == 'checkbox'){ }}
							    <!--得保证value是有序数组--->
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  {{#  arr_foreach(value.value, function(k1, v1){ }}
										  {{#  if(in_array(k1, value.default)){ }}
											<input lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-label="{{value.label}}" type="checkbox" name="{{item.db_table}}[{{value.field}}][]" value="{{k1}}" title="{{v1}}" checked="" data-tabinx="{{index}}">
										  {{# }else{ }}   
											<input lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-label="{{value.label}}" type="checkbox" name="{{item.db_table}}[{{value.field}}][]" value="{{k1}}" title="{{v1}}" data-tabinx="{{index}}">
										  {{# } }} 
									  {{#  }); }}
							      </div>
							    </div>		
							{{#  }else if(value.input_type == 'number'){ }}
							    <!--得保证value是有序数组--->
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  <input data-label="{{value.label}}" type="number" name="{{item.db_table}}[{{value.field}}]"  maxlength="{{value.input_maxlength}}"  placeholder="请输入{{value.label}}" autocomplete="off" class="layui-input" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" value="{{input_default(value.default)}}" data-tabinx="{{index}}">
							      </div>
							    </div>	
							{{#  }else if(value.input_type == 'float'){ }}
							    <!--得保证value是有序数组--->
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  <input data-label="{{value.label}}" type="number" name="{{item.db_table}}[{{value.field}}]"  maxlength="{{value.input_maxlength}}"  min="{{value.input_min}}"  step="{{value.input_step}}"  placeholder="请输入{{value.label}}" autocomplete="off" class="layui-input" lay-verify="{{#  if(value.null == 'no'){ }}required|number{{#  } }}" data-tabinx="{{index}}">
							      </div>
							    </div>		
							{{#  }else if(value.input_type == 'select'){ }}
							    <!--得保证value是有序数组--->
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  <select data-label="{{value.label}}" name="{{item.db_table}}[{{value.field}}]" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
									    <option value="">请选择</option>
									  {{#  arr_foreach(value.value, function(k1, v1){ }}
										  {{#  if(is_avoidBrowser(v1)){ }}
										  		{{#  if(v1.key == value.default){ }}
										  			<option value="{{v1.key}}" selected="">{{v1.val}}</option>
										  		{{# }else{ }} 
										  			<option value="{{v1.key}}">{{v1.val}}</option>
										  		{{#  } }} 
										  {{# }else{ }} 											
										  		{{#  if(k1 == value.default){ }}
										  		<option value="{{k1}}" selected="">{{v1}}</option>
										  		{{# }else{ }} 
										  		<option value="{{k1}}">{{v1}}</option>
										  		{{#  } }} 
										  {{#  } }} 
									  {{#  }); }}
									  </select>
							      </div>
							    </div>	
							{{#  }else if(value.input_type == 'color'){ }}
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
							        <input data-label="{{value.label}}" type="color" name="{{item.db_table}}[{{value.field}}]" value="{{input_default(value.default)}}" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}" style="height: 38px;width: 80px;" />
							      </div>
							    </div>	
							
							{{#  }else if(value.input_type == 'textarea'){ }}
							    <div class="layui-form-item">
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  <textarea data-label="{{value.label}}" name="{{item.db_table}}[{{value.field}}]" placeholder="请输入{{value.label}}" class="layui-textarea" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">{{input_default(value.default)}}</textarea>
							      </div>
							    </div>		
							{{#  }else if(value.input_type == 'image'){ }}
							    <div class="layui-form-item">
								  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
							      <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							      <div class="layui-input-block">
									  <div class="finder-image-preview" data-type="one-image">
										 <div class="clone-one-image" style="position: absolute; right: 5px; top:5px; z-index: 99;display: none;" onclick="cloneOneImage(this, '{{item.db_table}}[{{value.field}}]');">
											  <i class="layui-icon layui-icon-close-fill" style="font-size: 24px;"></i>
										  </div>
										
										<input class="image_input"  name="{{item.db_table}}[{{value.field}}]" value="" type="hidden"  />
										<div class="image-preview" onclick="oneImageSelect(this, '{{item.db_table}}[{{value.field}}]');">请选择一张图片</div>
										<div class="preview-text" ></div>
									  </div>
							      </div>
							    </div>	
							{{#  }else if(value.input_type == 'images'){ }}
							    <div class="layui-form-item">
								  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
								  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
								  <div class="layui-input-block">
										<div class="finder-image">
											<div class="finder-image-preview" data-type="more-image">
												 <div class="clone-one-image" style="position: absolute; right: 5px; top:5px; z-index: 99;display: none;" onclick="cloneMoreImage(this, '{{item.db_table}}[{{value.field}}]');">
													  <i class="layui-icon layui-icon-close-fill" style="font-size: 24px;"></i>
												  </div>
												
												<input class="image_input"  name="{{item.db_table}}[{{value.field}}][]" value="" type="hidden"  />
												<div class="image-preview" onclick="moreImageSelect(this, '{{item.db_table}}[{{value.field}}]');">请选择一张或多张图片</div>
												<div class="preview-text" ></div>
											</div>
										</div>
								  </div>
								</div>	
								{{#  }else if(value.input_type == 'video'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div class="finder-image-preview" data-type="one-video">
												 <div class="clone-one-image" style="position: absolute; right: 5px; top:5px; z-index: 99;display: none;" onclick="cloneOneImage(this, '{{item.db_table}}[{{value.field}}]');">
													  <i class="layui-icon layui-icon-close-fill" style="font-size: 24px;"></i>
												  </div>
												
												<input class="image_input"  name="{{item.db_table}}[{{value.field}}]" value="" type="hidden"  />
												<div class="image-preview" onclick="oneVideoSelect(this, '{{item.db_table}}[{{value.field}}]');">请选择一个视频</div>
												<div class="preview-text" ></div>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'videos'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div class="finder-image">
												<div class="finder-image-preview" id="finder-image-{{item.db_table}}[{{value.field}}]" data-type="more-video">
													 <div class="clone-one-image" style="position: absolute; right: 5px; top:5px; z-index: 99;display: none;" onclick="cloneMoreImage(this, '{{item.db_table}}[{{value.field}}]');">
														  <i class="layui-icon layui-icon-close-fill" style="font-size: 24px;"></i>
													  </div>
													
													<input class="image_input"  name="{{item.db_table}}[{{value.field}}][]" value="" type="hidden"  />
													<div class="image-preview" onclick="moreVideoSelect(this, '{{item.db_table}}[{{value.field}}]');">请选择一个或多个视频</div>
													<div class="preview-text" ></div>
												</div>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'audio'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}"  id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  height:38px; overflow: hidden; width:70%;float:left;">    
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" onClick="oneAudioSelect(this, '{{item.db_table}}[{{value.field}}]')">浏览</button>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'audios'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}"  id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  min-height:22px; height: auto; overflow: hidden; width:70%;float:left; padding: 8px;">    
																
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" onClick="moreAudioSelect(this, '{{item.db_table}}[{{value.field}}]')">浏览</button>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'document'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">	
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  height:38px; overflow: hidden; width:70%;float:left;">    
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" onClick="oneDocumentSelect(this, '{{item.db_table}}[{{value.field}}]')">浏览</button>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'documents'){ }}
								    <div class="layui-form-item">
										<input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
										<label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
										<div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  min-height:22px; height: auto; overflow: hidden; width:70%;float:left; padding: 8px;">    
												
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" onClick="moreDocumentSelect(this, '{{item.db_table}}[{{value.field}}]')">浏览</button>
											</div>
										</div>
									 </div>	
								{{#  }else if(value.input_type == 'date'){ }}
								    <div class="layui-form-item">
										<label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
										<div class="layui-input-block">
											<input data-label="{{value.label}}" type="text" name="{{item.db_table}}[{{value.field}}]"  id="{{item.db_table}}_{{value.field}}"  placeholder="请输入{{value.label}}" autocomplete="off" class="layerdate layui-input"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" value="{{input_date(value.default)}}" data-tabinx="{{index}}">
										</div>
									 </div>	 
								{{#  }else if(value.input_type == 'time'){ }}
								    <div class="layui-form-item">
										<label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
										<div class="layui-input-block">
											<input data-label="{{value.label}}" type="text" name="{{item.db_table}}[{{value.field}}]" id="{{item.db_table}}_{{value.field}}"  placeholder="请输入{{value.label}}" autocomplete="off" class="layertime layui-input"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" value="{{input_time(value.default)}}" data-tabinx="{{index}}">
										</div>
									 </div>		
								{{#  }else if(value.input_type == 'checkboxwindow'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  height:38px; overflow: hidden; width:70%;float:left;">    								
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" data-valuetable="{{value.value_table}}"  data-title="{{value.label}}" onClick="moreOpenSelect(this, '{{item.db_table}}[{{value.field}}]')">选择</button>
											</div>
									  </div>
									</div>
								{{#  }else if(value.input_type == 'radiowindow'){ }}
								    <div class="layui-form-item">
									  <input data-label="{{value.label}}" id="validation-{{item.db_table}}[{{value.field}}]"  type="text" style="display: none;"  lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<div>
											  <ul class="layui-tab-title" style="border: 1px solid #eee;  height:38px; overflow: hidden; width:70%;float:left;">    								
											  </ul>
											  <button style="float: left; width: 80px; margin-left: 5px;" type="button" class="layui-btn layui-btn-primary" data-valuetable="{{value.value_table}}" data-title="{{value.label}}" onClick="oneOpenSelect(this, '{{item.db_table}}[{{value.field}}]')">选择</button>
											</div>
									  </div>
									</div>	
								{{#  }else if(value.input_type == 'baidueditor'){ }}
								    <div class="layui-form-item">
									  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
									  <div class="layui-input-block">
											<textarea data-label="{{value.label}}" id="{{item.db_table}}_{{value.field}}" name="{{item.db_table}}[{{value.field}}]" placeholder="请输入{{value.label}}" class="layui-textarea baidueditor"  style="width:100%;height:400px;" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" data-tabinx="{{index}}">{{input_default(value.default)}}</textarea>
											
									  </div>
									</div>			
								{{#  }else if(value.input_type == 'file'){ }}
									<div class="layui-form-item">
										<label class="layui-form-label">{{value.label}}</label>
										<div class="layui-input-block" style='color:#f00; padding-top: 10px;'>
										分步骤表单不支持file组件 请使用document代替
										</div>
									</div>
							{{# }else{ }} 
							
							<div class="layui-form-item">
							  <label class="layui-form-label">{{#  if(value.null == 'no'){ }}<span class="required">*</span>{{#  } }}{{value.label}}</label>
							  <div class="layui-input-block">
							    <input data-label="{{value.label}}" type="{{value.input_type}}" name="{{item.db_table}}[{{value.field}}]" placeholder="请输入{{value.label}}" autocomplete="off" class="layui-input" lay-verify="{{#  if(value.null == 'no'){ }}required{{#  } }}" value="{{input_default(value.default)}}" data-tabinx="{{index}}">
							  </div>
							</div>
							
							{{# } }} 
							
						{{#  }); }}
					</div>
					{{#  }); }}
				  </div>
				</div>
				
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button type="button" class="layui-btn layui-btn-primary" id="upButton" style="display: none;" >上一步</button>
						<button type="button" class="layui-btn layui-btn-primary" id="nextButton" lay-filter="nextButton">下一步</button>
						<button class="layui-btn" lay-submit lay-filter="formDemo" data-tabindex="0" style="display: none;" id="submitButton">立即提交</button>
					</div>
				</div>
			</form>
			
		</div>
		<script src="/admin/utils/layui/layui.js" charset="utf-8"></script>
		<script src="/admin/utils/layui/config.js" charset="utf-8"></script>
		<script>
			window.var_dump = function(text) {
				console.log(text);
				return text;
			}
		
		
			layui.use(['laytpl', 'helper', 'formbuilder', 'view', 'element'], function() {
				var laytpl = layui.laytpl;
				var data = eval('(' + $("#menu-data", parent.document).val() + ')');
				if(data.stepform_fields.length == 1){
					$("#nextButton").css("display","none");
					$("#submitButton").css("display","");
				}
				var getTpl = document.getElementById('view').innerHTML;
				var view = document.getElementById('view');
				var element = layui.element;
				if ($_GET['_method_']) {
					$("#_method_").val($_GET['_method_']);
				}
				for (i in data['stepform_fields']) {
					if (data['stepform_fields'][i]['db_table'] == '__DB_TABLE__') {
						data.stepform_fields[i]['field'] = data.table_struct.field;
					}
				}
				var stepformData = data;
				var getTpl = document.getElementById('view').innerHTML;
				var view = document.getElementById('view');
				laytpl(getTpl).render(data, function(html) {
					view.innerHTML = html;
		
					//切换tab监听
					element.on('tab(docDemoTabBrief)', function() {
						if (this.getAttribute("data-index") > 0 && this.getAttribute("data-index") < document.getElementById(
								"layui-tab-ul").getElementsByTagName('li').length - 1) {
							document.getElementById("upButton").style.display = '';
							document.getElementById("nextButton").style.display = '';
							document.getElementById("submitButton").style.display = 'none';
						} else if (this.getAttribute("data-index") == 0) {
							document.getElementById("upButton").style.display = 'none';
							if(data.stepform_fields.length > 1){
								document.getElementById("nextButton").style.display = '';
								document.getElementById("submitButton").style.display = 'none';
							}
						} else if (this.getAttribute("data-index") <= document.getElementById("layui-tab-ul").getElementsByTagName(
								'li').length - 1) {
							document.getElementById("upButton").style.display = '';
							document.getElementById("nextButton").style.display = 'none';
							document.getElementById("submitButton").style.display = '';
						}
					});
		
					layui.use(['form', 'laydate'], function() {
						var laydate = layui.laydate;
						var $ = layui.$;
						$(".layerdate").each(function(index) {
							laydate.render({
								elem: '#' + this.id //指定元素
							});
						});
		
						//时间输入框
						$(".layertime").each(function(index) {
							laydate.render({
								elem: '#' + this.id, //指定元素
								type: 'datetime'
							});
						});
		
						$(".baidueditor").each(function(index) {
							var ue = UE.getEditor(this.id, {
								autoHeightEnabled: true,
								autoFloatEnabled: true
							});
						});
						setepformButton();
						var form = layui.form;
						form.verify(window.stepFormVerifyConf);
						//监听提交
						form.on('submit(formDemo)', function(data) {
							window.submitData = data.field;
							let formdata = stepLayFormData(data, stepformData);
							submit_request($_GET['api'], 'POST', formdata, function(res) {
								//询问框 编辑的话需要改变值
								var index = layer.confirm('添加成功 需要继续添加么?', {
									btn: ['继续', '返回列表'] //按钮
								}, function() {
									window.location.reload(); //刷新自己继续添加
									//关闭这个弹窗
								}, function() {
									parent.window.location.reload();
								});
							});
						});
		
					});
				});
		
			});
		</script>
		
	</body>
</html>
